package com.wc.alorithm_blue_bridge_history.littlewhite.Q231209.Q8731;
import java.util.Scanner;

/**
 * @Author congege
 * @Description
 * @Date Created in 2023/12/9-20:05
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n + 1];
        int[] dpl = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            a[i] = sc.nextInt();
        }
        int maxLen = 0;
        for (int i = 1; i <= n; i++) {
            dpl[i] = 1;
            for (int j = 1; j < i; j++) {
                if (a[i] > a[j]) {
                    dpl[i] = Math.max(dpl[j] + 1, dpl[i]);
                }
            }
            maxLen = Math.max(maxLen, dpl[i]);
        }
        if (maxLen == n) {
            System.out.println(maxLen);
        } else {
            System.out.println(maxLen + 1);
        }
    }
}